﻿namespace NTLib.Pipe.Streaming.Formats
{
    using Containers;
    using Descriptors.Packages;
    using NTLib.Core.Component;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    /// <summary>
    /// Format the complex package into byte fields and reverse
    /// </summary>
    public interface IPackageFormater : IComponent, IDisposable
    {
        #region Properties

        /// <summary>
        /// Gets the reader descriptor.
        /// </summary>
        IPackageDescriptor ReaderDescriptor { get; }

        #endregion

        #region Methods

        /// <summary>
        /// Convert the data structure to an IPackage.
        /// </summary>
        IPackage ToPackage<T>(T data);

        /// <summary>
        /// Convert an IPackage structure to a data Structure.
        /// </summary>
        T FromPackage<T>(IPackage pkg);

        /// <summary>
        /// Convert an IPackage structure to a data Structure.
        /// </summary>
        object FromPackage(IPackage pkg, Type T);

        #endregion
    }
}
